<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="送货单打印" />
<%@ include file="../inc/PrintTitle.jsp"%>
<head>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doPrint(){
		ShowConfirm('确认框','确定开始打印吗？',340,80,"doPrintCallBack()");
	}
	function doPrintCallBack(){
		if(popRetVal!=null){
			document.getElementById("noPrinSpan").style.display="none";
			printContent("管理易-送货单","${enterpriseInfo.doPrint}","${enterpriseInfo.printWidth}");
			document.getElementById("noPrinSpan").style.display="";
		}
	}
	function doCancel(){
		window.close();
	}
	function showTotalDiv(favCost,bbCost,remaCost,cost,divId){
		var str="业务单总金额："+bbCost;
		if(favCost!=0){
			str=str+"(已优惠："+favCost+")";
		}
		str=str+"&nbsp;&nbsp尚欠款："+remaCost;
		str=str+"&nbsp;&nbsp本次送货：(金额大写)";
		str=str+getBigMoney(""+cost);
		str=str+"<b>￥</b>"+cost+"&nbsp;";
		document.getElementById(divId).innerHTML=str;
	}
</script>
</head>
<body style="background-color:#FFFFFF">
<table width="100%" border="0"  align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
				<tr>
					<td width="16%" rowspan="2"><img src="${enterpriseInfo.loginImage}" /></td>
					<td width="68%" height="40px" align="center" class="FontLarge_Bold">${licenseInfo.enterpriseName} 送货单</td>
					<td width="16%">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2" align="right" valign="bottom">
						<div id="barcodeTarget"></div>
						<div class="FontSmall" style="padding-right:8px;">${record.clientCode}&nbsp;&nbsp;NO.&nbsp;${record.deliverBill.billCode}</div>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="ListTable">
				<tr class="ListTrPrint">
			      	<td class="FontSmall" width="70%" colspan="2">订货单位：${record.clientName}<c:if test="${est.deliPphone=='Y'}"> ${record.deliverBill.linkman} ${record.deliverBill.phone}</c:if></td>
			      	<td class="FontSmall" width="30%" align="right" style="padding-right:8px;">送货日期：<fmt:formatDate value="${record.deliverBill.deliverDate}" pattern="yyyy-MM-dd"/></td>
				</tr>
				<tr class="ListTrPrint">
					<td class="FontSmall" width="30%">业务单号：${record.bbCode}</td>
				  	<td class="FontSmall" width="40%">地址：<c:if test="${est.deliPphone=='Y'}">${record.deliverBill.address}</c:if></td>
					<td class="FontSmall" width="30%" align="right" style="padding-right:8px;">订货日期：<fmt:formatDate value="${record.bbDate}" pattern="yyyy-MM-dd"/></td>
			    </tr>
		  	</table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="small_border">
				<tr class="ListTrPrint">
				  <td width="9%" height="23" class="FontSmall_Bold"><div align="center">项目类型</div></td>
				  <td width="11%" class="FontSmall_Bold"><div align="center">内容</div></td>
				  <td width="12%" class="FontSmall_Bold"><div align="center">材质</div></td>
				  <td width="21%" class="FontSmall_Bold"><div align="center">规格</div></td>
				  <td width="7%" class="FontSmall_Bold"><div align="center">单位</div></td>
				  <td width="10%" class="FontSmall_Bold"><div align="center">本次送货</div></td>
				  <td width="7%" class="FontSmall_Bold"><div align="center">单价</div></td>
				  <td width="8%" class="FontSmall_Bold"><div align="center">金额</div></td>
				  <td width="15%" class="FontSmall_Bold"><div align="center">制作要求</div></td>
				</tr>
				<c:forEach var="item" items="${record.items}" varStatus="i">
				<tr class="ListTrPrint">
				  <td class="FontSmall"><div align="center">${item.makeTypeName}</div></td>
				  <td class="FontSmall"><div align="center"><commonTag:parseEnterToBr source="${item.finishedContent}" /></div></td>
				  <td class="FontSmall"><div align="center"><c:out value="${item.productName}" /></div></td>
				  <td class="FontSmall">
					  <div align="center">
					  <commonTag:parseEnterToBr source="${item.specification}" />
					  <c:if test="${item.priceType=='AREA' || item.priceType=='LENGTH'}"> x <commonTag:parseBigDecimal source="${item.deliverBillItem.amount}" /></c:if>
					  </div>
				  </td>
				  <td class="FontSmall"><div align="center">${item.unit}</div></td>
				  <td class="FontSmall"><div align="center"><commonTag:parseBigDecimal source="${item.amountStr}" /></div></td>		
				  <td class="FontSmall"><div align="center"><commonTag:parseBigDecimal source="${item.unitPrice}" /></div></td>
				  <td class="FontSmall"><div align="center"><commonTag:parseBigDecimal source="${item.cost}" /></div></td>
				  <td class="FontSmall"><div align="center"><commonTag:parseEnterToBr source="${item.makeRequire}" /></div></td>
				</tr>
				</c:forEach>
				<tr  class="ListTrPrint">
					<td class="FontSmall" colspan="9" >
						<div align="right" id="totalDiv">&nbsp;</div>
					</td>			  	
				</tr>	
			</table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center" class="ListTable">
				<tr class="ListTrPrint">
					<td class="FontSmall" width="33%">开单人：${record.deliverBill.createrName}</td>
					<td class="FontSmall" width="33%">送货人签名：</td>
					<td class="FontSmall" width="34%">客户签名：</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>	
	<c:if test="${codeRule.printFoot!=null && codeRule.printFoot!=''}">
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td class="FontSmall"><commonTag:parseEnterToBr source="${codeRule.printFoot}" /></td>
				</tr>
			</table>
		</td>
	</tr>
	</c:if>
	<tr id="noPrinSpan">
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td>
						<input type="button" id="printButton" class="Button" value=" 开始打印" onClick="doPrint();">
						<input type="button" id="cancelButton" class="Button" value=" 退 出 " onClick="doCancel();">
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>
<script language="javascript">
	showTotalDiv(${record.favCost},${record.bbCost},${record.remaCost},${record.cost},'totalDiv');
</script>
<c:if test="${enterpriseInfo.deliBc=='Y'}">
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery-barcode.js"></script>
<script language="javascript">
	var settings = {
			output: "css",
          	showHRI: false,
          	bgColor: "#FFFFFF",
      		color: "#000000",
          	barWidth: 1,
          	barHeight: 30
	};
	var value="${record.deliverBill.billCode}";
	//var btype="code39";
	var btype="code128";
	$("#barcodeTarget").html("").show().barcode(value, btype, settings);
</script>
</c:if>